<? 
include("protect1.php"); 
//$mkjur='mk'.$reg_jurusan;
$mkjur='mk';
?>

<STYLE type=text/css>.blank {
	FONT-SIZE: 0px; WIDTH: 0px; HEIGHT: 0px
}
TD {
	FONT-SIZE: 12px; COLOR: #000000; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif
}
INPUT {
	FONT-SIZE: 12px; COLOR: #000000; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif
}
.present {
	FONT-WEIGHT: bold; BACKGROUND-COLOR: #dee5ec
}
.h1 {
	FONT-WEIGHT: bold; FONT-SIZE: 12px; COLOR: #ffffff
}
.d1 {
	COLOR: #c0c0c0
}
.link {
	FONT-WEIGHT: bold; FONT-SIZE: 12px; CURSOR: hand; COLOR: #ffffff; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif; TEXT-DECORATION: none
}
.footer {
	FONT-WEIGHT: normal; FONT-SIZE: 10px; COLOR: #000000; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif; TEXT-DECORATION: none
}
.footer1 {
	FONT-WEIGHT: bold; FONT-SIZE: 10px; BACKGROUND-IMAGE: url(chat/images/menu_b.gif); CURSOR: default; COLOR: #000000; BORDER-BOTTOM: 0px
}
.header {
	FONT-WEIGHT: bold; FONT-SIZE: 10px; BACKGROUND-IMAGE: url(chat/images/menu_h.gif); CURSOR: default; COLOR: #000000; BORDER-BOTTOM: 0px
}
.textcol {
	FONT-SIZE: 12px; COLOR: #2378d5; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif
}
body,td,th {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 11pt;
	color: #FFFFFF;
}
body {
	background-image: url(bg.jpg);
	background-repeat: repeat;
}
a:link {
	color: #FFFFFF;
	text-decoration: none;
}
a:visited {
	text-decoration: none;
	color: #FFFFFF;
}
a:hover {
	text-decoration: underline;
	color: #001C89;
}
a:active {
	text-decoration: none;
	color: #011B89;
}
</STYLE>


<title>:: VIEW KRS ::</title><table width="780" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td bgcolor="7e96dc">&nbsp;</td>
  </tr>
  <tr>
    <td><img src="images/bannerAtas.jpg" alt="image" width="780" height="200" /></td>
  </tr>
  <tr>
    <td bgcolor="3a5db1">
	<?php
       $sel_sesi=$_GET["sel_sesi"];
	$sel_periode=$_GET["sel_periode"];
	//include("banner.html");
	include("connect.php");
	$pilih=mysql_select_db("uwika_krs",$conn);
	echo "<BR> <div align = center>";
	echo "Berikut dibawah ini adalah daftar mata kuliah yang sudah anda daftarkan pada KRS :";
	echo "<br>";
	echo "Semester : <b> " . $sel_sesi;
	echo "</b><br>";
	echo "Periode : <b> " . $sel_periode;
	echo "</b><br><BR>";
	echo "<table width=\"75%\" border=\"1\" align=center cellpadding=0 cellspacing=0>";
	echo "<tr>";
	echo "<td width=\"5%\" bgcolor=\"#001E8C\"><center>K O D E</center></td>";
	echo "<td width=\"20%\" bgcolor=\"#001E8C\"><center>N A M A &nbsp; M A T A  &nbsp; K U L I A H</center></td>";
	echo "<td width=\"5%\" bgcolor=\"#001E8C\"><center>STATUS</center></td>";
	echo "<td width=\"3%\" bgcolor=\"#001E8C\"><center>SKS</center></td>";
	echo "</tr>";

	$sqlstr="delete from registrasi where sks=0";
	//$hasil=mysql_query($sqlstr);
	$sqlstr="select registrasi.kodemk, $mkjur.nama, $mkjur.sks, registrasi.sesi, registrasi.status, registrasi.validasi, registrasi.hari, registrasi.mulaipukul, registrasi.selesaipukul from registrasi,$mkjur where sesi='$sel_sesi' and periode='$sel_periode' and nrp='$reg_uname' and registrasi.kodemk=$mkjur.kodemk";
	$hasil=mysql_query($sqlstr);
	$row = mysql_fetch_row($hasil);
	$jmlsks=0;
	do {
		list($kodemkx,$nama,$sks,$sesi,$status,$validasi,$harilama,$mulailama,$selesailama) = $row;
		if (empty($kodemkx)) {
		break;
		}
		$sqlstr2="select hari,mulaipukul, selesaipukul from penawaran where kodemk='$kodemkx' and jurusan='$reg_jurusan'";
		$updatejadwal=mysql_query($sqlstr2);
		list($haribaru,$mulaibaru,$selesaibaru) = mysql_fetch_row($updatejadwal);
		if ($harilama != $haribaru) {
			$sqlstr="update registrasi set hari='$haribaru' where nrp='$reg_uname' and kodemk='$kodemkx'";
			$updatejadwal=mysql_query($sqlstr);
		}
		if (($harilama == $haribaru) && ($mulailama != $mulaibaru)) {
			$sqlstr="update registrasi set mulaipukul='$mulaibaru' where nrp='$reg_uname' and kodemk='$kodemkx'";
			$updatejadwal=mysql_query($sqlstr);
		}
		if (($harilama == $haribaru) && ($selesailama != $selesaibaru)) {
			$sqlstr="update registrasi set selesaipukul='$selesaibaru' where nrp='$reg_uname' and kodemk='$kodemkx'";
			$updatejadwal=mysql_query($sqlstr);
		}
		if ($validasi==0) {	
			if (date("Y-m-d H:i:s") >= "2012-08-30 01:00:01" && date("Y-m-d H:i:s") <= "2012-09-14 11:59:59") // batasan waktu (jam 30 agust 13.00.01 - 14 sept 23.59.59)
//			if (date("Y-m-d H:i:s") >= "2012-08-29 13:00:01" && date("Y-m-d H:i:s") <= "2012-09-13 11:59:59") // batasan waktu
			echo "<tr><td><center><a href=\"hapus.php?nrp=$reg_uname&kodemk=$kodemkx&sesi=$sesi&periode=$sel_periode\"> $kodemkx </center></td>";
		   else
			echo "<tr><td><center>$kodemkx</center></td>";	
		} else {
			echo "<tr><td><center>$kodemkx</center></td>";
		}
		echo "<td> $nama </td>";
		echo "<td><center> $status </center></td>";
		echo "<td><center> $sks </center></td>";
		echo "</tr>";
		$jmlsks=$jmlsks + $sks; 
	} while ($row=mysql_fetch_row($hasil));
	echo "</td></td><td width=5%></td></tr></table>";//</table>";
	echo "<table width=\"75%\" border=\"0\">";
	echo "<tr><td width=\"30%\"></td><td><p align=\"right\">TOTAL SKS : </p></td><td width=10%><center>";
	if ($jmlsks > 24) {
		echo "<b><font color=\"#FF0000\">$jmlsks</font></b>";
		echo "<br>";
		echo "</center></td><td width=5%></td></tr>";
		echo "</table>";
		echo "<center><b><font color=#FF0000>Jumlah SKS yang anda ambil tidak boleh melebihi 24 SKS !!!</font></b></center>";

	} else {
		echo $jmlsks;
	}
	echo "</center</td></tr>";
	echo "</table>";
	echo "<br>";
	if ($validasi==0) {
		echo "*** Klik pada kode mata kuliah untuk membatalkan mata kuliah dalam KRS anda ***";
	} else {
		echo "*) KRS ini sudah disetujui oleh dosen wali. Selamat menempuh perkuliahan. Sukses !";
	}
	echo "&nbsp;";
	echo "<br><br>";
	$sqlstr="select sks,ips,toleransi from ips where nrp='$reg_uname'";
	$hasil=mysql_query($sqlstr);
	$row = mysql_fetch_row($hasil);
	list($sks,$ips,$toleransi) = $row;
	$sqlstr="select sum(sks) from registrasi where nrp='$reg_uname'";
	$hasil=mysql_query($sqlstr);
	$row = mysql_fetch_row($hasil);
	list($sksdlmkrs) = $row;

	if ($ips < 1.500) {
		$limitsksx = 12;
	}
	if (($ips >= 1.500) and ($ips < 1.750)) {
		$limitsksx = 14;
	}
	if (($ips >= 1.750) and ($ips < 2.000)) {
		$limitsksx = 16;
	}
	if (($ips >= 2.000) and ($ips < 2.250)) {
		$limitsksx = 18;
	}
	if (($ips >= 2.250) and ($ips < 3.000)) {
		$limitsksx = 21;
	}
	if ($ips >= 3.000) {
		$limitsksx = 24;
	}
		/*
		mengubah disini YULIUS H
		untuk siswa angkatan baru agar tidak 12 SKS
	*/
	$pengecekan = $reg_uname[3].$reg_uname[4];
	if ($pengecekan == 12)
	{
		$limitsksx = 24;
	}
	// Sampai disini saja!
	echo "<table width=75%>";
	$sqlstr="SELECT biodata.nama FROM security,biodata where security.username='$reg_uname' and biodata.nrp=security.username";
	$hasil=mysql_query($sqlstr);
	$row = mysql_fetch_row($hasil);
	list($namamhs) = $row;
	echo "<tr><td width=20%>N R P</td><td>:</td><td width=83%>$reg_uname</td></tr>";
	echo "<tr><td width=20%>N A M A</td><td>:</td><td width=83%>$namamhs</td></tr>";
	echo "<tr><td width=20%>Nilai IPS terakhir </td><td>:</td><td width=83%>$ips</td></tr>";
	echo "<tr><td>Limit SKS anda</td><td>:</td><td>$limitsksx SKS</td></tr>";
	echo "<tr><td>Toleransi SKS anda</td><td>:</td><td>$toleransi SKS</td></tr>";
	echo "<tr><td>Sisa Limit SKS anda</td><td>:</td><td>";
	echo $limitsksx+$toleransi-$sksdlmkrs;
	echo " SKS</td></tr></table>";
	echo "</div><br>";
/*PENAMBAHAN TEMPAT untuk TANDA TANGAN*/
	echo "<div align=center>";
	echo "	<table border=1 width=75%>";
	echo "		<tr>";
	echo "			<td width=150 align=center>DOSEN WALI</td>";
	echo "			<td width=150 align=center>BAA</td>";
	echo "			<td width=150 align=center>MAHASISWA</td>";
	echo "		</tr>";
	echo "		<tr height=75>";
	echo "			<td width=150 align=center>&nbsp;</td>";
	echo "			<td width=150 align=center>&nbsp;</td>";
	echo "			<td width=150 align=center>&nbsp;</td>";
	echo "		</tr>";
	echo "		<tr>";
	echo "			<td width=150 align=center>(__________________)</td>";
	echo "			<td width=150 align=center>(__________________)</td>";
	echo "			<td width=150 align=center>($reg_uname)</td>";
	echo "		</tr>";
	echo "	</table>";
//	echo "	<table><tr><td align=left>";		
	echo "	<font size=2><strong><i>";
	echo "		*) Dibuat Rangkap 2 (Dua): (1)DOSEN WALI, (2)BAA, dan (3)MAHASISWA <br>";
	echo "		**) WAJIB Membubuhkan Tanda Tangan Di Tiap Kolom Yang Disiapkan";
	echo "	</i></strong></font>";
//	echo "	</table></td></tr>";
	echo "</div>";
	/*
	echo "<hr>";
	echo "Jika anda kenal dengan orang-orang dibawah ini, sampaikan kepada mereka bahwa registrasi KRS mereka tidak boleh melebihi 24 SKS.";
	echo "<br>";
	echo "Untuk informasi lebih lanjut, silahkan anda hubungi Direktur Akademis Universitas, Bapak Muliadi Tedja Sukmana. Terimakasih.";
	echo "<br><br>";
	$sqlstr="select ips.ips,registrasi.nrp,sum(registrasi.sks),biodata.nama from registrasi, biodata, ips where biodata.nrp=registrasi.nrp and ips.nrp=registrasi.nrp group by registrasi.nrp order by registrasi.nrp";
	$hasil=mysql_query($sqlstr);
	$row = mysql_fetch_row($hasil);
	$counter=0;
	do {
		list($ips, $nrp,$sks, $nama) = $row;
		if ($sks > 24) {
			$counter++;
			echo $nrp . "-" . $nama . " (" . $ips . ") " . $sks . "<br>";
		}
	} while ($row=mysql_fetch_row($hasil));
    echo "Jumlah Total : " . $counter;
	*/

	include("footer.php");
?>
	&nbsp;</td>
  </tr>
  <tr>
    <td bgcolor="7e96dc"><div align="center">copyleft ICT 2012 </div></td>
  </tr>
</table>
